Camel binding support in SwitchYard allows Camel components to be used as gateway bindings for services and references within an application.
Binding Services with Camel
Every camel component binding supported by SwitchYard has it's own configuration namespace. However, there is asmall exception. Bindings for direct, seda, timer and mock share same namespace urn:switchyard-component-camel-core:config:1.0.
Composite-level services can be bound to a Camel component using the <binding.uri> binding definition. The following configuration options are available for binding.uri:
-
configURI : contains the Camel endpoint URI used to configure a Camel component instance
-
operationSelector : specification of the operation to use for the message exchange. See Operation Selector for more details. This setting is not used for cxfrs configurations.
binding.uri is not linked with any specific component. It allows usage of 3rd party camel components which are not part of distribution.
Before SwitchYard 0.7 binding.camel element was used instead of binding.uri
Here's an example of what a service binding looks like using a Camel component.
<sca:composite name="SimpleCamelService" targetNamespace="urn:userguide:simple-camel-service:0.1.0">
<sca:service name="SimpleCamelService" promote="SimpleComponent/SimpleCamelService">
<camel:binding.uri configURI="file://target/input?fileName=test.txt&initialDelay=50&delete=true">
<selector:operationSelector operationName="print"/>
</camel:binding.uri>
</sca:service>
<!-- sca:component definition omitted -->
</sca:composite>
Binding References with Camel
Binding a reference with Camel is very similar to binding a service. The only significant difference is that specification of the operationSelector is not required on reference bindings. Logically reference elements points to outgoing communication eg. service called by Switchyard.
<sca:composite name="orders" targetNamespace="urn:switchyard-quickstart-demo:orders:0.1.0">
<sca:reference name="WarehouseService" promote="OrderComponent/WarehouseService" multiplicity="1..1">
<camel:binding.uri configURI="file://target/output"/>
</sca:reference>
</sca:composite>